package com.weixin.paleituo.adapter;

import android.content.Context;
import android.view.View;
import android.widget.TextView;

import com.weixin.paleituo.R;
import com.weixin.paleituo.base.BaseRecycleAdapter;
import com.weixin.paleituo.bean.CityBean;
import com.weixin.paleituo.help.RecycleViewHolder;

import java.util.List;

/**
 * Author yichao
 * Time  2018/6/28 10:17
 * Dest  选择城市
 */

public class SelectCityRecyclewAdapter extends BaseRecycleAdapter<CityBean> {
    public SelectCityRecyclewAdapter(Context context, List<CityBean> datas) {
        super(context, datas, R.layout.item_city );
    }

    @Override
    protected void setData(RecycleViewHolder holder, CityBean cityBean, final int position) {
        TextView tvCity=holder.getItemView(R.id.tv_city_name_item_city);
        tvCity.setText(cityBean.getCityName());


        tvCity.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                if (mOnListener!=null){
                    mOnListener.onItemClick(position);
                }
            }
        });



    }
    private OnListener mOnListener;
    public void setOnListener(OnListener onListener){
        this.mOnListener=onListener;
    }

    public interface  OnListener{

        void  onItemClick(int positon);
    }

}
